import { IPSModelSortable } from '../../ipsmodel-sortable';
import { IPSDEDataRelation } from './ipsdedata-relation';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysImage } from '../../res/ipssys-image';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEDataRelationImpl extends PSModelObjectImpl implements IPSDEDataRelation, IPSModelSortable {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  protected formcappslanguageres: IPSLanguageRes | null = null;

  getFormCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.formcappslanguageres != null) return this.formcappslanguageres;
    const value = this.M.getFormCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.formcappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getFormCapPSLanguageRes') as IPSLanguageRes;
    return this.formcappslanguageres;
  }

  get formCapPSLanguageRes(): IPSLanguageRes | null {
    return this.getFormCapPSLanguageRes();
  }

  getFormCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getFormCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定编辑项标题语言资源');
    }
    return value;
  }

  get formCaption(): string {
    return this.M.formCaption;
  }

  protected formpssysimage: IPSSysImage | null = null;

  getFormPSSysImage(): IPSSysImage | null {
    if (this.formpssysimage != null) return this.formpssysimage;
    const value = this.M.getFormPSSysImage;
    if (value == null) {
      return null;
    }
    this.formpssysimage = this.getPSModel4('res.IPSSysImage', value, 'getFormPSSysImage') as IPSSysImage;
    return this.formpssysimage;
  }

  get formPSSysImage(): IPSSysImage | null {
    return this.getFormPSSysImage();
  }

  getFormPSSysImageMust(): IPSSysImage {
    const value = this.getFormPSSysImage();
    if (value == null) {
      throw new Error('未指定编辑项图标资源');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get hideEditItem(): boolean {
    return this.M.hideEditItem;
  }

  get cls(): string {
    return 'PSDEDataRelationImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'dataentity.dr.IPSDEDataRelation') return true;
    return super.instanceof(cls);
  }
}
